package com.zlll.winner.controller.sys;

import com.alibaba.fastjson.JSONObject;
import com.zlll.winner.business.service.common.IEnumService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(value = "/sys/enums")
public class EnumsController {

    @Reference
    private IEnumService enumService;

    @GetMapping(value = "/{enumType}")
    public Object getEnum(@PathVariable String enumType){
        return enumService.getBaseEnumMap(enumType);
    }

    @PostMapping(value = "getBaseEnumPlus")
    public Object getEnumPlus(@RequestBody JSONObject params){
        String enumType = params.getString("enumType");
        String packagePath = params.getString("packagePath");
        return enumService.getBaseEnumMap(packagePath,enumType);
    }

    @PostMapping(value = "getEnumByPath")
    public Object getEnumByPath(@RequestBody JSONObject params) throws Exception {
        String packagePath = params.getString("packagePath");
        return enumService.getEnumByPath(packagePath);
    }

}
